﻿using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using HomagChina.CCT.BaseUI.ViewModel;
using HomagChina.CCT.BaseUI.DataModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using static HomagChina.CCT.BaseUI.ProcessResourceInternal;
using static HomagChina.CCT.BaseUI.Utility;
using Application = System.Windows.Application;
using localText = HomagChina.Basic.CCT.ResourceLibrary.Properties.Resources;
using MenuItem = HomagGroup.Base.UI.Controls.MenuItem;
using UserControl = System.Windows.Controls.UserControl;
using HomagChina.CCT.BaseUI;
using HomagGroup.BaseUI.Router;

namespace HomagChina.CCT.BaseUI.Router
{
    public class TransHistoryRoute
    {
        public RouterItemDataModel TransHistoryRouteModel { get; set; }

        public TransHistoryRoute()
        {
            var TransHistoryViewModel = new TransHistoryViewModel();
            TransHistoryRouteModel = new RouterItemDataModel()
            {
                ID = "TransHistory",
                viewLabel = localText.TransHistory,
                viewName = "TransHistory",
                viewModelName = "TransHistoryViewModel",
                ViewModel = TransHistoryViewModel,
                keepalive = false,
                userControl = (UserControl)GetUserControlInstance("TransHistory"),
                Image = null,
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>{
                            new FunctionKeyBarItemDataModel() {
                                Header =localText.Filter_off , Position = 9,  Icon = GetIconBrush(Icon.ViewGrid,overlayIcon:OverlayIcon.Check),
                                Command=new RelayCommand(TransHistoryViewModel.HandleIsShowFilter)
                            },
                            new FunctionKeyBarItemDataModel() {
                                Header =localText.Extras, Position = 10, Icon = GetIconBrush(Icon.More, overlayIcon: OverlayIcon.None),MenuItems = new List<MenuItem>
                                {
                                    new MenuItem { Header = localText.Settings, Icon =GetResourceBrush("items") },
                                    new MenuItem { Header = localText.Create_service_file, Icon= GetResourceBrush("TableSettingsImage")  }
                                }
                            },
                            new FunctionKeyBarItemDataModel(){
                                Header = localText.Advanced,Position = 8, Icon = GetResourceBrush("Advanced"),  MenuItems = new List<MenuItem>
                                {
                                    new MenuItem {
                                        Header = localText.Freeze,IsCheckable = true,
                                        Command=new RelayCommand(TransHistoryViewModel.HandleIsFreeze)
                                    },
                                    new MenuItem {
                                        Header = localText.TransHistory ,IsCheckable = true,
                                        Command=new RelayCommand(TransHistoryViewModel.HandleIsHistory)
                                    }
                                }
                            },
                            new FunctionKeyBarItemDataModel() {
                                Header = localText.Exit, Position = 12, Icon = GetIconBrush(Icon.Close, ImageDecoration.Circle),
                                Command = new RelayCommand(() => { Application.Current.Shutdown(); })
                            },
                            new FunctionKeyBarItemDataModel() {
                                Header = localText.Error_message, Position = 11, Icon = GetResourceBrush("ErrorMessages"),
                                Command = new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("ErrorMessages"); })
                            },
                            //new FunctionKeyBarItemDataModel() {
                            //    Header = localText.Info, Position = 1, Icon = GetIconBrush(Icon.Information, imageDecoration: ImageDecoration.Circle),
                            //    Command = new RelayCommand(() => { Handle_Common.OpenInformationCommand(Handle_Search.GetSystemInfoMation()); })
                            //}
                      }
            };
            TransHistoryRouteModel.userControl.DataContext = TransHistoryRouteModel.ViewModel;
        }
    }
}